* Replication code for Held, Alexander (2023): "The Effect of Socioeconomic
* Policy and Competence Messages on Populist Radical Right Support: Evidence
* from a Pre-Election Survey Experiment"

* Set the working directory to the folder on your computer with the replication dataset
* cd "C:\..."

use "data.dta", clear

* TABLE 2:
reg vi_afd t1 t2 t3 t4 ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd, robust

* Covariate-adjusted AfD vote intention for control group:
margins, at(t1=0 t2=0 t3=0 t4=0)

reg vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime, robust

* One-tailed significance tests:
* p-values for t1 (economy) and t2 (leadership):
display 0.014/2
display 0.094/2

reg vi_spd t1 t2 t3 t4 ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime, robust

reg vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime, robust



* FIGURE 1:

* The following (optional) graphic scheme requires the installation of the gr0070
* package from Bischof (2017).
* Reference:
* Bischof, Daniel. 2017. "New Graphic Schemes for Stata: plotplain and plottig." The Stata Journal 17(3): 748-759.
set scheme plotplain
reg vi_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd, robust
estimates store afd1
coefplot (afd1), keep(t1 t2 t3 t4) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership" t3="Redist." t4="Anti-Grand Coal.") ///
	title("(a) AfD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.1 .1)) ylabel(-.1 "-10" -.05 "-5" 0 "0" .05 "5" .1 "10", angle(horizontal)) ///
	ytick(-.1(.05).1)
graph save "Figure_afd1.gph", replace
reg vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime, robust
estimates store cdu1
coefplot (cdu1), keep(t1 t2) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership") ///
	title("(b) CDU/CSU vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.1 .1)) ylabel(-.1 "-10" -.05 "-5" 0 "0" .05 "5" .1 "10", angle(horizontal)) ///
	ytick(-.1(.05).1)
graph save "Figure_cdu1.gph", replace
reg vi_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime, robust
estimates store spd1
coefplot (spd1), keep(t3) yline(0) ///
    coeflabels(t3="Redistribution") ///
	title("(c) SPD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.1 .1)) ylabel(-.1 "-10" -.05 "-5" 0 "0" .05 "5" .1 "10", angle(horizontal)) ///
	ytick(-.1(.05).1)
graph save "Figure_spd1.gph", replace
reg vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime, robust
estimates store fdpgr1
coefplot (fdpgr1), keep(t4) yline(0) ///
    coeflabels(t4="Anti-Grand Coalition") ///
	title("(d) FDP/Greens vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.1 .1)) ylabel(-.1 "-10" -.05 "-5" 0 "0" .05 "5" .1 "10", angle(horizontal)) ///
	ytick(-.1(.05).1)
graph save "Figure_fdpgr1.gph", replace
graph combine "Figure_afd1.gph" "Figure_cdu1.gph" "Figure_spd1.gph" "Figure_fdpgr1.gph"



* FIGURE 2: Early days vs closer to election
reg vi_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd if date==1 | date==2, robust
estimates store afd2a
reg vi_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd if date==3 | date==4 | date==5, robust
estimates store afd2b
coefplot (afd2a, label(Early days (15-16 days before the election))) (afd2b, label(Closer to election (10-12 days before the election))), keep(t1 t3 t4 t2) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership" t3="Redist." t4="Anti-Grand Coal.") ///
	title("(a) AfD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_afd2.gph", replace
reg vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime if date==1 | date==2, robust
estimates store cdu2a
reg vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime if date==3 | date==4 | date==5, robust
estimates store cdu2b
coefplot (cdu2a, label(Early days (15-16 days before the election))) (cdu2b, label(Closer to election (10-12 days before the election))), keep(t1 t2) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership") ///
	title("(b) CDU/CSU vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_cdu2.gph", replace
reg vi_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime if date==1 | date==2, robust
estimates store spd2a
reg vi_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime if date==3 | date==4 | date==5, robust
estimates store spd2b
coefplot (spd2a, label(Early days (15-16 days before the election))) (spd2b, label(Closer to election (10-12 days before the election))), keep(t3) yline(0) ///
    coeflabels(t3="Redistribution") ///
	title("(c) SPD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_spd2.gph", replace
reg vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime if date==1 | date==2, robust
estimates store fdpgr2a
reg vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime if date==3 | date==4 | date==5, robust
estimates store fdpgr2b
coefplot (fdpgr2a, label(Early days (15-16 days before the election))) (fdpgr2b, label(Closer to election (10-12 days before the election))), keep(t4) yline(0) ///
    coeflabels(t4="Anti-Grand Coalition") ///
	title("(d) FDP/Greens vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_fdpgr2.gph", replace
graph combine "Figure_afd2.gph" "Figure_cdu2.gph" "Figure_spd2.gph" "Figure_fdpgr2.gph"
* OPTIONAL: Install the grc1leg package. Program by Vince Wiggins, StataCorp <vwiggins@stata.com>. Statalist distribution, 16 June 2003.
grc1leg "Figure_afd2.gph" "Figure_cdu2.gph" "Figure_spd2.gph" "Figure_fdpgr2.gph"



* FIGURE 3: Heterogeneities by political knowledge
reg vi_afd i.t1##c.know i.t2##c.know i.t3##c.know i.t4##c.know ///
	ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd, robust
margins, dydx(t1) at(know = (0(1)5) t2=0 t3=0 t4=0) level(95)
marginsplot, name(f0k1) ytitle("Treatment effect") ///
	xtitle("Political knowledge") yscale(range(-.2 (.1) .2))  ylabel(-.2 "-20"  ///
	-.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	title("(a) Economy") ytick(-.2(.1).2)
margins, dydx(t2) at(know = (0(1)5) t1=0 t3=0 t4=0) level(95)
marginsplot, name(f0k2) ytitle("Treatment effect") ///
	xtitle("Political knowledge") yscale(range(-.2 (.1) .2))  ylabel(-.2 "-20"  ///
	-.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	title("(b) Leadership") ytick(-.2(.1).2)
margins, dydx(t3) at(know = (0(1)5) t1=0 t2=0 t4=0) level(95)
marginsplot, name(f0k3) ytitle("Treatment effect") ///
	xtitle("Political knowledge") yscale(range(-.2 (.1) .2))  ylabel(-.2 "-20"  ///
	-.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	title("(c) Redistribution") ytick(-.2(.1).2)
margins, dydx(t4) at(know = (0(1)5) t1=0 t2=0 t3=0) level(95)
marginsplot, name(f0k4) ytitle("Treatment effect") ///
	xtitle("Political knowledge") yscale(range(-.2 (.1) .2))  ylabel(-.2 "-20"  ///
	-.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	title("(d) Anti-Grand Coalition") ytick(-.2(.1).2)
graph combine f0k1 f0k2 f0k3 f0k4





* APPENDIX

* APPENDIX A.1, Table 1, column 1 (for results from GLES in columns 2-4, see replication code below):
sum female East educHS educRS educGY income0_1499 income1500_2499 income2500_3999 income4000pl incomemiss unionmbr age18_29 ///
 age30_44 age45_59 age60pl mii_imm pid_afd pid_cdu pid_spd pid_fdpgr pid_no
sum vi_afd if t1==0 & t2==0 & t3==0 & t4==0



* APPENDIX A.3 (Tables 2-5):
* BALANCE TABLES
reg female t1 t2 t3 t4
reg East t1 t2 t3 t4 
reg educHS t1 t2 t3 t4
reg educRS t1 t2 t3 t4
reg educGY t1 t2 t3 t4
reg income0_1499 t1 t2 t3 t4
reg income1500_2499 t1 t2 t3 t4
reg income2500_3999 t1 t2 t3 t4
reg income4000pl t1 t2 t3 t4
reg incomemiss  t1 t2 t3 t4
reg unionmbr  t1 t2 t3 t4
reg age18_29 t1 t2 t3 t4
reg age30_44 t1 t2 t3 t4
reg age45_59  t1 t2 t3 t4
reg age60pl  t1 t2 t3 t4
reg	mii_imm  t1 t2 t3 t4
reg	mii_terr  t1 t2 t3 t4
reg	mii_crime t1 t2 t3 t4
reg	pid_afd t1 t2 t3 t4
reg	pid_cdu t1 t2 t3 t4
reg	pid_spd t1 t2 t3 t4
reg	pid_fdpgr  t1 t2 t3 t4
reg	pid_no  t1 t2 t3 t4



* APPENDIX A.4 (Table 6):
sum female East educRS educGY income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
 age30_44 age45_59 age60pl mii_imm mii_terr mii_crime pid_afd pid_cdu pid_spd pid_fdpgr pid_no



* APPENDIX A.5: MULTIPLE COMPARISON ADJUSTMENT
* The adjusted p-value that takes multiple hypothesis tests into account was
* calculated in R (set seed 12345) using and adjusting the code from point 7 of
* Coppock, Alexander. 2015. "10 Things You Need to Know about Multiple Comparisons." EGAP Methods Guides.
* https://egap.org/resource/10-things-to-know-about-multiple-comparisons/


 
 * APPENDIX A.6 (Table 7):
logit vi_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd, robust

logit vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime, robust

logit vi_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime, robust

logit vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime, robust



* APPENDIX A.7 (Table 8):
reg pf_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd, robust

reg pf_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime, robust

reg pf_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime, robust

reg pf_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime, robust



* APPENDIX A.8 (Tables 9, 10, 11):
logit vi_afd ftimm female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd if t1==0 & t2==0 & t3==0 & t4==0, robust

logit vi_afd ftimm female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pvi_afd pvi_nonafd if t1==0 & t2==0 & t3==0 & t4==0, robust

* As specified in the pre-analysis plan (PAP), I use the model with the better model
* fit to predict each respondent's AfD vote probability. From the two models above,
* model 2 (R squared = 0.50) has a better model fit than model 1 (R squared = 0.40).
* Thus, in line with the PAP, model 2 is used to predicted AfD vote probabilities.
predict p
summarize p, detail
gen afdlean=0
replace afdlean=1 if p>.1085535

sum female East educHS educRS educGY income0_1499 income1500_2499 income2500_3999 income4000pl incomemiss unionmbr age18_29 ///
 age30_44 age45_59 age60pl mii_imm mii_terr mii_crime pid_afd pid_cdu pid_spd pid_fdpgr pid_no if afdlean==0
sum vi_afd if t1==0 & t2==0 & t3==0 & t4==0 & afdlean==0

sum female East educHS educRS educGY income0_1499 income1500_2499 income2500_3999 income4000pl incomemiss unionmbr age18_29 ///
 age30_44 age45_59 age60pl mii_imm mii_terr mii_crime pid_afd pid_cdu pid_spd pid_fdpgr pid_no if afdlean==1
sum vi_afd if t1==0 & t2==0 & t3==0 & t4==0 & afdlean==1


gen t1Xafdlean=t1*afdlean
gen t2Xafdlean=t2*afdlean
gen t3Xafdlean=t3*afdlean
gen t4Xafdlean=t4*afdlean
gen ftimmXafdlean=ftimm*afdlean
gen t1XftimmXafdlean=t1Xftimm*afdlean
gen t2XftimmXafdlean=t2Xftimm*afdlean
gen t3XftimmXafdlean=t3Xftimm*afdlean
gen t4XftimmXafdlean=t4Xftimm*afdlean
gen femaleXafdlean=female*afdlean
gen age30_44Xafdlean=age30_44*afdlean
gen age45_59Xafdlean=age45_59*afdlean
gen age60plXafdlean=age60pl*afdlean
gen EastXafdlean=East*afdlean
gen educRSXafdlean=educRS*afdlean
gen educGYXafdlean=educGY*afdlean
gen income1500_2499Xafdlean=income1500_2499*afdlean
gen income2500_3999Xafdlean=income2500_3999*afdlean
gen income4000plXafdlean=income4000pl*afdlean
gen incomemissXafdlean=incomemiss*afdlean
gen unionmbrXafdlean=unionmbr*afdlean
gen mii_immXafdlean=mii_imm*afdlean
gen mii_terrXafdlean=mii_terr*afdlean
gen mii_crimeXafdlean=mii_crime*afdlean
gen pid_afdXafdlean=pid_afd*afdlean
gen pid_nonafdXafdlean=pid_nonafd*afdlean
gen pid_cduXafdlean=pid_cdu*afdlean
gen pid_noXafdlean=pid_no*afdlean
gen pid_spdXafdlean=pid_spd*afdlean
gen pid_fdpgrXafdlean=pid_fdpgr*afdlean

reg vi_afd t1 t2 t3 t4 afdlean t1Xafdlean t2Xafdlean t3Xafdlean t4Xafdlean ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd ///
	ftimmXafdlean t1XftimmXafdlean t3XftimmXafdlean t4XftimmXafdlean t2XftimmXafdlean ///
	femaleXafdlean age30_44Xafdlean age45_59Xafdlean age60plXafdlean EastXafdlean educRSXafdlean educGYXafdlean ///
	income1500_2499Xafdlean income2500_3999Xafdlean income4000plXafdlean incomemissXafdlean unionmbrXafdlean ///
	mii_immXafdlean mii_terrXafdlean mii_crimeXafdlean pid_afdXafdlean pid_nonafdXafdlean, robust

reg vi_cdu t1 t2 t3 t4 afdlean t1Xafdlean t2Xafdlean t3Xafdlean t4Xafdlean ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_cdu pid_no ///
	ftimmXafdlean t1XftimmXafdlean t3XftimmXafdlean t4XftimmXafdlean t2XftimmXafdlean ///
	femaleXafdlean age30_44Xafdlean age45_59Xafdlean age60plXafdlean EastXafdlean educRSXafdlean educGYXafdlean ///
	income1500_2499Xafdlean income2500_3999Xafdlean income4000plXafdlean incomemissXafdlean unionmbrXafdlean ///
	mii_immXafdlean mii_terrXafdlean mii_crimeXafdlean pid_afdXafdlean pid_cduXafdlean pid_noXafdlean, robust

reg vi_spd t1 t2 t3 t4 afdlean t1Xafdlean t2Xafdlean t3Xafdlean t4Xafdlean ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_spd pid_no ///
	ftimmXafdlean t1XftimmXafdlean t3XftimmXafdlean t4XftimmXafdlean t2XftimmXafdlean ///
	femaleXafdlean age30_44Xafdlean age45_59Xafdlean age60plXafdlean EastXafdlean educRSXafdlean educGYXafdlean ///
	income1500_2499Xafdlean income2500_3999Xafdlean income4000plXafdlean incomemissXafdlean unionmbrXafdlean ///
	mii_immXafdlean mii_terrXafdlean mii_crimeXafdlean pid_afdXafdlean pid_spdXafdlean pid_noXafdlean, robust

reg vi_fdpgr t1 t2 t3 t4 afdlean t1Xafdlean t2Xafdlean t3Xafdlean t4Xafdlean ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_fdpgr pid_no ///
	ftimmXafdlean t1XftimmXafdlean t3XftimmXafdlean t4XftimmXafdlean t2XftimmXafdlean ///
	femaleXafdlean age30_44Xafdlean age45_59Xafdlean age60plXafdlean EastXafdlean educRSXafdlean educGYXafdlean ///
	income1500_2499Xafdlean income2500_3999Xafdlean income4000plXafdlean incomemissXafdlean unionmbrXafdlean ///
	mii_immXafdlean mii_terrXafdlean mii_crimeXafdlean pid_afdXafdlean pid_fdpgrXafdlean pid_noXafdlean, robust



reg pf_afd t1 t2 t3 t4 afdlean t1Xafdlean t2Xafdlean t3Xafdlean t4Xafdlean ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd ///
	ftimmXafdlean t1XftimmXafdlean t3XftimmXafdlean t4XftimmXafdlean t2XftimmXafdlean ///
	femaleXafdlean age30_44Xafdlean age45_59Xafdlean age60plXafdlean EastXafdlean educRSXafdlean educGYXafdlean ///
	income1500_2499Xafdlean income2500_3999Xafdlean income4000plXafdlean incomemissXafdlean unionmbrXafdlean ///
	mii_immXafdlean mii_terrXafdlean mii_crimeXafdlean pid_afdXafdlean pid_nonafdXafdlean, robust

reg pf_cdu t1 t2 t3 t4 afdlean t1Xafdlean t2Xafdlean t3Xafdlean t4Xafdlean ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_cdu pid_no ///
	ftimmXafdlean t1XftimmXafdlean t3XftimmXafdlean t4XftimmXafdlean t2XftimmXafdlean ///
	femaleXafdlean age30_44Xafdlean age45_59Xafdlean age60plXafdlean EastXafdlean educRSXafdlean educGYXafdlean ///
	income1500_2499Xafdlean income2500_3999Xafdlean income4000plXafdlean incomemissXafdlean unionmbrXafdlean ///
	mii_immXafdlean mii_terrXafdlean mii_crimeXafdlean pid_afdXafdlean pid_cduXafdlean pid_noXafdlean, robust

reg pf_spd t1 t2 t3 t4 afdlean t1Xafdlean t2Xafdlean t3Xafdlean t4Xafdlean ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_spd pid_no ///
	ftimmXafdlean t1XftimmXafdlean t3XftimmXafdlean t4XftimmXafdlean t2XftimmXafdlean ///
	femaleXafdlean age30_44Xafdlean age45_59Xafdlean age60plXafdlean EastXafdlean educRSXafdlean educGYXafdlean ///
	income1500_2499Xafdlean income2500_3999Xafdlean income4000plXafdlean incomemissXafdlean unionmbrXafdlean ///
	mii_immXafdlean mii_terrXafdlean mii_crimeXafdlean pid_afdXafdlean pid_spdXafdlean pid_noXafdlean, robust

reg pf_fdpgr t1 t2 t3 t4 afdlean t1Xafdlean t2Xafdlean t3Xafdlean t4Xafdlean ftimm t1Xftimm t3Xftimm t4Xftimm t2Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_fdpgr pid_no ///
	ftimmXafdlean t1XftimmXafdlean t3XftimmXafdlean t4XftimmXafdlean t2XftimmXafdlean ///
	femaleXafdlean age30_44Xafdlean age45_59Xafdlean age60plXafdlean EastXafdlean educRSXafdlean educGYXafdlean ///
	income1500_2499Xafdlean income2500_3999Xafdlean income4000plXafdlean incomemissXafdlean unionmbrXafdlean ///
	mii_immXafdlean mii_terrXafdlean mii_crimeXafdlean pid_afdXafdlean pid_fdpgrXafdlean pid_noXafdlean, robust



* APPENDIX A.9 (Figure 1):
reg vi_afd t1 t2 t3 t4 ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd if (date==1 | date==2) & ftimm==1, robust
estimates store afd4a
reg vi_afd t1 t2 t3 t4 ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd if (date==1 | date==2) & ftimm==0, robust
estimates store afd4b
coefplot (afd4a, label(Not most anti-immigrant (categories 8-10))) (afd4b, label(Most anti-immigrant (category 11))), keep(t1 t2 t3 t4) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership" t3="Redist." t4="Anti-Grand Coal.") ///
	title("(a) AfD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_afd4.gph", replace
reg vi_cdu t1 t2 t3 t4 ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime if (date==1 | date==2) & ftimm==1, robust
estimates store cdu4a
reg vi_cdu t1 t2 t3 t4 ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime if (date==1 | date==2) & ftimm==0, robust
estimates store cdu4b
coefplot (cdu4a, label(Not most anti-immigrant (categories 8-10))) (cdu4b, label(Most anti-immigrant (category 11))), keep(t1 t2) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership") ///
	title("(b) CDU/CSU vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.3 .2)) ylabel(-.3 "-30" -.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.3(.1).2) legend(off)
graph save "Figure_cdu4.gph", replace
reg vi_spd t1 t2 t3 t4 ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime if (date==1 | date==2) & ftimm==1, robust
estimates store spd4a
reg vi_spd t1 t2 t3 t4 ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime if (date==1 | date==2) & ftimm==0, robust
estimates store spd4b
coefplot (spd4a, label(Not most anti-immigrant (categories 8-10))) (spd4b, label(Most anti-immigrant (category 11))), keep(t3) yline(0) ///
    coeflabels(t3="Redistribution") ///
	title("(c) SPD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_spd4.gph", replace
reg vi_fdpgr t1 t2 t3 t4 ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime if (date==1 | date==2) & ftimm==1, robust
estimates store fdpgr4a
reg vi_fdpgr t1 t2 t3 t4 ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime if (date==1 | date==2) & ftimm==0, robust
estimates store fdpgr4b
coefplot (fdpgr4a, label(Not most anti-immigrant (categories 8-10))) (fdpgr4b, label(Most anti-immigrant (category 11))), keep(t4) yline(0) ///
    coeflabels(t4="Anti-Grand Coalition") ///
	title("(d) FDP/Greens vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_fdpgr4.gph", replace
graph combine "Figure_afd4.gph" "Figure_cdu4.gph" "Figure_spd4.gph" "Figure_fdpgr4.gph"
* With the grc1leg package by Vince Wiggins (optional):
grc1leg "Figure_afd4.gph" "Figure_cdu4.gph" "Figure_spd4.gph" "Figure_fdpgr4.gph"



* APPENDIX A.10 (Figure 2):
reg vi_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd if mii_imm==0, robust
estimates store afd5a
reg vi_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd if mii_imm==1, robust
estimates store afd5b
coefplot (afd5a, label(Immigration is not the most important issue)) (afd5b, label(Immigration is the most important issue)), keep(t1 t2 t3 t4) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership" t3="Redist." t4="Anti-Grand Coal.") ///
	title("(a) AfD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_afd5.gph", replace
reg vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime if mii_imm==0, robust
estimates store cdu5a
reg vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime if mii_imm==1, robust
estimates store cdu5b
coefplot (cdu5a, label(Immigration is not the most important issue)) (cdu5b, label(Immigration is the most important issue)), keep(t1 t2) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership") ///
	title("(b) CDU/CSU vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_cdu5.gph", replace
reg vi_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime if mii_imm==0, robust
estimates store spd5a
reg vi_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime if mii_imm==1, robust
estimates store spd5b
coefplot (spd5a, label(Immigration is not the most important issue)) (spd5b, label(Immigration is the most important issue)), keep(t3) yline(0) ///
    coeflabels(t3="Redistribution") ///
	title("(c) SPD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_spd5.gph", replace
reg vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime if mii_imm==0, robust
estimates store fdpgr5a
reg vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime if mii_imm==1, robust
estimates store fdpgr5b
coefplot (fdpgr5a, label(Immigration is not the most important issue)) (fdpgr5b, label(Immigration is the most important issue)), keep(t4) yline(0) ///
    coeflabels(t4="Anti-Grand Coalition") ///
	title("(d) FDP/Greens vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_fdpgr5.gph", replace
graph combine "Figure_afd5.gph" "Figure_cdu5.gph" "Figure_spd5.gph" "Figure_fdpgr5.gph"
* With the grc1leg package by Vince Wiggins (optional):
grc1leg "Figure_afd5.gph" "Figure_cdu5.gph" "Figure_spd5.gph" "Figure_fdpgr5.gph"



* APPENDIX A.11 (Table 12):
* Results in this table are based on data from the GLES. See replication code below.



* APPENDIX A.12 (Figure 3):
reg vi_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	if date==1 | date==2, robust
estimates store afd6a
reg vi_afd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	if date==3 | date==4 | date==5, robust
estimates store afd6b
coefplot (afd6a, label(Early days (15-16 days before the election))) (afd6b, label(Closer to election (10-12 days before the election))), keep(t1 t2 t3 t4) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership" t3="Redist." t4="Anti-Grand Coal.") ///
	title("(a) AfD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_afd6.gph", replace
reg vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	if date==1 | date==2, robust
estimates store cdu6a
reg vi_cdu t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	if date==3 | date==4 | date==5, robust
estimates store cdu6b
coefplot (cdu6a, label(Early days (15-16 days before the election))) (cdu6b, label(Closer to election (10-12 days before the election))), keep(t1 t2) yline(0) ///
    coeflabels(t1="Economy" t2="Leadership") ///
	title("(b) CDU/CSU vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_cdu6.gph", replace
reg vi_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	if date==1 | date==2, robust
estimates store spd6a
reg vi_spd t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	if date==3 | date==4 | date==5, robust
estimates store spd6b
coefplot (spd6a, label(Early days (15-16 days before the election))) (spd6b, label(Closer to election (10-12 days before the election))), keep(t3) yline(0) ///
    coeflabels(t3="Redistribution") ///
	title("(c) SPD vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_spd6.gph", replace
reg vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	if date==1 | date==2, robust
estimates store fdpgr6a
reg vi_fdpgr t1 t2 t3 t4 ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	if date==3 | date==4 | date==5, robust
estimates store fdpgr6b
coefplot (fdpgr6a, label(Early days (15-16 days before the election))) (fdpgr6b, label(Closer to election (10-12 days before the election))), keep(t4) yline(0) ///
    coeflabels(t4="Anti-Grand Coalition") ///
	title("(d) FDP/Greens vote intention") ytitle("Treatment effect") vertical ///
	yscale(range(-.2 .2)) ylabel(-.2 "-20" -.1 "-10" 0 "0" .1 "10" .2 "20", angle(horizontal)) ///
	ytick(-.2(.1).2) legend(off)
graph save "Figure_fdpgr6.gph", replace
graph combine "Figure_afd6.gph" "Figure_cdu6.gph" "Figure_spd6.gph" "Figure_fdpgr6.gph"
* With the grc1leg package by Vince Wiggins (optional):
grc1leg "Figure_afd6.gph" "Figure_cdu6.gph" "Figure_spd6.gph" "Figure_fdpgr6.gph"



* APPENDIX A.14 (Table 13):
reg vi_afd i.t1##c.know i.t2##c.know i.t3##c.know i.t4##c.know ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	mii_imm mii_terr mii_crime pid_afd pid_nonafd, robust

reg vi_cdu i.t1##c.know i.t2##c.know i.t3##c.know i.t4##c.know ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_cdu pid_no mii_imm mii_terr mii_crime, robust

reg vi_spd i.t1##c.know i.t2##c.know i.t3##c.know i.t4##c.know ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_spd pid_no mii_imm mii_terr mii_crime, robust

reg vi_fdpgr i.t1##c.know i.t2##c.know i.t3##c.know i.t4##c.know ftimm t1Xftimm t2Xftimm t3Xftimm t4Xftimm ///
	female age30_44 age45_59 age60pl East educRS educGY ///
	income1500_2499 income2500_3999 income4000pl incomemiss unionmbr ///
	pid_afd pid_fdpgr pid_no mii_imm mii_terr mii_crime, robust



* APPENDIX A.1 (Table 1, columns 2-4) and APPENDIX A.11 (Table 12):

* These results are based on data from the German Longitudinal Election Study (GLES).
* Access to the data from the 2017 pre-election cross section of the German Longi-
* tudinal Election Study (GLES 2019; dataset: ZA6800_de_v5-0-1.dta) can be obtained
* from the following website: https://doi.org/10.4232/1.13234.
 
* Reference:
* GLES (2019). Pre-election Cross Section (GLES 2017). GESIS Data Archive, Cologne. ZA6800 Data file Version 5.0.1, https://doi.org/10.4232/1.13234.


* APPENDIX A.1 (Table 1, columns 2-4):
use "ZA6800_de_v5-0-1.dta", clear
recode q11ba (-100/321=0) (322=1) (323/999=0), gen(vi_afd)
recode q60 (-99/-98=.), gen(q60_nom)
recode q60 (-99/-98=.) (1/8=0) (9/11=1), gen(q60_rec)
recode q60 (-99/-98=.) (1/10=0) (11=1), gen(q60_recb)
recode q60 (-99/-98=.) (1/7=0) (8/10=1) (11=2), gen(q60_tab)
recode q22_c1 (-99/0=.) (1/3749=0) (3750/3757=1) (3758/5000=0), gen(mii_imm)

tab q1  // female
tab q1 if q60_recb==1
tab q1 if vi_afd==1

tab ostwest
tab ostwest if q60_recb==1
tab ostwest if vi_afd==1

tab q136  // education
tab q136 if q60_recb==1
tab q136 if vi_afd==1

tab q192  // income
recode q192 (1/5=1)(6/7=2)(8/9=3)(10/13=4)(-99/-98=5), gen(income)
tab income
tab income if q60_recb==1
tab income if vi_afd==1

tab q190a // union member
tab q190a if q60_recb==1
tab q190a if vi_afd==1

* age
recode q2a (1988/1999=1)(1973/1987=2)(1958/1972=3)(1921/1957=4), gen(age)
tab age
tab age if q60_recb==1
tab age if vi_afd==1

* most important issue
tab mii_imm
tab mii_imm if q60_recb==1
tab mii_imm if vi_afd==1

tab q99a  // PID
tab q99a if q60_recb==1
tab q99a if vi_afd==1

tab vi_afd  // AfD vote intention
tab vi_afd if q60_recb==1
tab vi_afd if vi_afd==1



* APPENDIX A.11 (Table 12):
tab vi_afd q60, row
recode q60 (-99/-98=.)(1/7=1)(8/10=2)(11=3), gen(antiimm_new)
tab vi_afd antiimm_new, row

